@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <a href="/admin/" class="caption-home"><i class="fa fa-home"></i> </a>
                <a href="/admin/">{{ ts('Dashboard') }}</a>
                <i class="fa fa-angle-right"></i>
                <span class="active">{{ @$page['title'] }}</span>
            </div>
            <div class="actions">
                <div class="item">
                    <a href="/{{ request()->path() }}/create" class="btn btn-sm btn-primary">{{ ts('addnew') }}</a>
                </div>
            </div>
        </div>

        <div class="filter-wrapper">
            <form action="/{{ request()->path() }}/" class="form-inline filter-form">
                <div class=" input-group mb-3 custom-control-inline">
                    <div class="input-group-prepend">
                        <select name="label" class="form-control">
                            <option value="id" {{ request()->input('label') == 'id' ? 'selected' : '' }}>{{ ts('warrantyid') }}</option>
                            <option value="first_name" {{ request()->input('label') == 'first_name' ? 'selected' : '' }}>{{ ts('contactperson') }}</option>
                            {{--<option value="phone_number" {{ request()->input('label') == 'phone_number' ? 'selected' : '' }}>{{ ts('contactinformation') }}</option>--}}
                            <option value="license_plate" {{ request()->input('label') == 'license_plate' ? 'selected' : '' }}>{{ ts('LICENSEPLATE') }}</option>
                        </select>
                    </div>
                    <input type="text" class="form-control" name="value" value="{{ request()->input('value') }}">
                </div>

                <div class="mb-3">
                    <button class="btn btn-primary">{{ ts('SEARCH') }}</button>
                    <a href="/{{ request()->path() }}/" class="btn btn-warning">{{ ts('RESET') }}</a>
                </div>

            </form>
        </div>

        <div>
            <table class="table table-s1">
                <thead>
                <tr class="order_column">
                    <th>{{ ts('sequence') }}</th>
                    <th data-column="id">{{ ts('warrantyid') }}</th>
                    <th data-column="first_name">{{ ts('customername') }}</th>
                    <th data-column="license_plate">{{ ts('licenseplate') }}</th>
                    <th data-column="user_id">{{ ts('SUPERIORDEALER') }}</th>
                    <th>{{ ts('SUPERIORDISTRIBUTOR') }}</th>
                    <th style="width:270px">{{ ts('OPTION') }}</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $k => $v)
                    <tr class="item-list">
                        <td>
                            <div class="truncated-3">{{ @$data->firstItem()+$k }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->id }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->first_name }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->license_plate }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->dealer->company_name }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->dealer->distributor->company_name }}</div>
                        </td>
                        <td>
                            <a class="btn btn-success btn-sm" href='/{{ request()->path() }}/{{ $v->id }}' target="_blank">{{ ts('VIEW') }}</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            <div class="my-3">
                {{ $data->appends(request()->input())->links() }}
            </div>
        </div>

    </div>


@endsection